package cn.yzh.control;

import cn.yzh.pojo.Student;
import cn.yzh.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author 严志辉
 * 创建 2020/8/20 20:33
 * @version 1
 */
@Controller
@RequestMapping("/sc")
public class StudentControl {

    @Autowired
    private IStudentService studentService;

    @RequestMapping("all")
    public String All(){
        return  "Student.jsp";
    }

    @RequestMapping("fs")
    public String findAll(Student stu, Model model){
        List<Student> students=studentService.findAll(stu);
        model.addAttribute("student",students);
        return  "redirect:sc/all";
    }
}
